﻿using System.Runtime.Serialization;
using ProxyTool.Setting;

namespace ProxyTool.Models
{
    /// <summary>
    ///     上下文信息
    /// </summary>
    [DataContract]
    public class ContextInfo
    {
        /// <summary>
        ///     企业ID
        /// </summary>
        [DataMember]
        public string EnterpriseID { get; set; }

        /// <summary>
        ///     组织编码
        /// </summary>
        [DataMember]
        public string OrgCode { get; set; }

        /// <summary>
        ///     用户编码
        /// </summary>
        [DataMember]
        public string UserCode { get; set; }

        /// <summary>
        ///     密码
        /// </summary>
        [DataMember]
        public string Password { get; set; }

        /// <summary>
        ///     语言
        /// </summary>
        [DataMember]
        public string Culture { get; set; }

        /// <summary>
        ///     支持语言列表，多个中间用,分隔
        /// </summary>
        [DataMember]
        public string SupportCultureNameList { get; set; }

        public static ContextInfo GetContext()
        {
            ContextInfo contextInfo = new ContextInfo();
            contextInfo.EnterpriseID = SettingManagement.Instance.Setting.EnterpriseID;
            contextInfo.OrgCode = SettingManagement.Instance.Setting.OrgCode;
            contextInfo.UserCode = SettingManagement.Instance.Setting.UserCode;
            contextInfo.Password = SettingManagement.Instance.Setting.Password;
            contextInfo.Culture = SettingManagement.Instance.Setting.Culture;
            contextInfo.SupportCultureNameList = SettingManagement.Instance.Setting.SupportCultureNameList;
            return contextInfo;
        }
    }

    /// <summary>
    ///     BPSV类型
    /// </summary>
    [DataContract]
    public class BPSVType
    {
        /// <summary>
        ///     名称
        /// </summary>
        [DataMember]
        public string DisplayName { get; set; }

        /// <summary>
        ///     类全名
        /// </summary>
        [DataMember]
        public string FullName { get; set; }

        /// <summary>
        ///     程序集
        /// </summary>
        [DataMember]
        public string AssemblyName { get; set; }

        /// <summary>
        ///     类型
        /// </summary>
        [DataMember]
        public string Kind { get; set; }

        /// <summary>
        ///     事务类型
        /// </summary>
        [DataMember]
        public string TransactionType { get; set; }
    }
}